home *** CD-ROM | disk | FTP | other *** search
- Path: newsroom.hitc.com!usenet
- From: Chris Ruegger <cruegger@eos.hitc.com>
- Newsgroups: comp.lang.c++
- Subject: Inline function problem
- Date: 10 Jan 1996 18:29:25 GMT
- Organization: Hughes Information Technology Corporation
- Message-ID: <4d10i5$bc3@newsroom.hitc.com>
- NNTP-Posting-Host: rainman.hitc.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 1.12 (X11; I; SunOS 5.4 sun4m)
- X-URL: news:comp.lang.c++
-
- I thought I was able to do the following but I am getting an
- unresolved reference:
-
- (Running SunOS 5.4)
-
- // in file foo.H
- class FOO {
- public:
- int x();
- private:
- int x_;
- };
-
- // in file foo.C:
- #include <foo.H>
- inline int FOO::x() {return x_;}
-
- // main.C
- #include <foo.H>
- #include <iostream.h>
- int main(int argc, char *argv[])
- {
- FOO myfoo;
- cout << myfoo.x() << endl;
- }
-
- When I try to link, I get:
-
- Undefined first referenced
- symbol in file
- FOO::x(void) main.o
- ld: fatal: Symbol referencing errors. No output written to main
-
- }
-
-
- Is this a compiler specific thing or illegal C++?
-
-
-
- --------------------------------------------------------------------
- Christopher Ruegger phone: (301) 925-1164
- Email: cruegger@eos.hitc.com
- car@access.digex.com
-
-